
<pre>
<?php

require_once("../../Bootstrap.php");

function Test1()
{
	$m1 = new cMatrix(4,1);
	$m1->data[0] = array(1,2,3,4);
	
	$m2 = new cMatrix(4,4);
	$m2->data[0] = array(1,2,3,4);
	$m2->data[1] = array(1,2,3,4);
	$m2->data[2] = array(1,2,3,4);
	$m2->data[3] = array(1,2,3,4);
	
	echo $m1."\n";
	
	echo $m2."\n";
	
	echo "================\n";
	
	echo cMatrix::mul($m1,$m2);
	echo "GOOD:\n10, 20, 30, 40\n\n";
}

function Test2()
{
	$m1 = new cMatrix(4,4);
	$m1->data[0] = array(1,2,3,4);
	$m1->data[1] = array(1,2,3,4);
	$m1->data[2] = array(1,2,3,4);
	$m1->data[3] = array(1,2,3,4);
	
	$m2 = new cMatrix(1,4);
	$m2->data[0] = array(1);
	$m2->data[1] = array(2);
	$m2->data[2] = array(3);
	$m2->data[3] = array(4);
	
	echo $m1."\n";
	
	echo $m2."\n";
	
	echo "================\n";
	
	echo cMatrix::mul($m1,$m2);
	echo "GOOD:\n30\n30\n30\n30\n\n";
}

function Test3()
{
	$m1 = new cMatrix(4,4);
	$m1->data[0] = array(-3,5,4,7);
	$m1->data[1] = array(2,-1,-6,9);
	$m1->data[2] = array(9,-7,-2,1);
	$m1->data[3] = array(5,-5,6,4);
	
	$m2 = new cMatrix(4,4);
	$m2->data[0] = array(-7,8,9,-1);
	$m2->data[1] = array(1,-6,-4,5);
	$m2->data[2] = array(7,-7,8,9);
	$m2->data[3] = array(6,4,4,-8);
	
	echo $m1."\n";
	
	echo $m2."\n";
	
	echo "================\n";
	
	echo cMatrix::mul($m1,$m2);
	echo "GOOD:\n96, -54, 13, 8\n-3, 100, 10, -133\n-78, 132, 97, -70\n26, 44, 129, -8\n\n";	
}




Test1();
Test2();
Test3();

?>
</pre>